 {
        
        var o = require("../../../UIManager/UISoundManager.js");
        cc.Class({
            extends: cc.Component,
            properties: {
                rankingPre: cc.Prefab,
                mask: cc.Node,
                rankSprite: cc.Sprite
            },
            onLoad: function () {
                if (Global.notificationCenter.on(Global.eventName.MSG_UPDATE_RANK_TYPE, this._setRankType_WXonShow.bind(this), this),
                    this.isScrolling = !1, this.isShow = !1, this.setData(), 2 == tywx.UserInfo.systemType) {
                    this.arrow = Global.utils.searchNode(this.node, "arrow");
                    var e = this.arrow.getPosition();
                    this.arrow.setPosition(e.x + 70, e.y);
                }
            },
            setData: function () {
                var e = Global.config.QueryTag.groupRank;
                this.rankType = Global.config.RankType.FRIEND;
                var t = null;
                Global.query && Global.query.extraInfo && Global.query.extraInfo[e] && (t = Global.myLaunchOption.shareTicket),
                    this.setRankTypeByShareTicket(t);
            },
            start: function () {
            },
            onClickRanking: function () {
                if (!this.isScrolling) {
                    if (this.isLock) return Global.utils.showWaitting(), void (this.isAutoShowRank = !0);
                    this.isScrolling = !0, this.ranking ? this.doAction() : this.createRanking();
                }
            },
            doAction: function () {
                this.isShow ? (tywx.NotificationCenter.trigger(tywx.EventType.MSG_SHOW_GAME_INTERACTION, !0),
                    this.hideBigRank()) : (tywx.NotificationCenter.trigger(tywx.EventType.MSG_SHOW_GAME_INTERACTION, !1),
                    this.mask.active = !0, this.ranking.getComponent("rankingScrollView").setData(this, this.shareTicket),
                    this.scrollToShow());
            },
            showRank: function (e) {
                console.log("=======showRank type========== :", this.rankType, e, !this.main), this.rankType == e && this.main ? console.log("不需要更新排行榜画布") : this.rankType = e;
            },
            showRankListForShare: function () {
                if (cc.sys.platform === cc.sys.WECHAT_GAME) {
                    this.ranking && this.ranking.getComponent("rankingScrollView").unDraw(this.rankType),
                        console.log("获取公共数据域数据");
                    var e = wx.getOpenDataContext().canvas;
                    e.width = 106, e.height = 409, Global.utils.searchNode(this.node, "content").height = e.height;
                    this.shareTicket ? Global.utils_Share.showGroupRank(this.shareTicket, !0) : Global.utils_Share.showFriendRank(!0),
                    e || cc.error("sharedCanvas不存在"), canvas || cc.error("canvas不存在");
                    var t = new cc.Texture2D(), n = new cc.SpriteFrame(t), o = this.rankSprite;
                    this.main = function () {
                        t.initWithElement(e), t.handleLoadedTexture(), o.spriteFrame = n, o.spriteFrame._refreshTexture(t);
                    }, this.main(), tywx.Timer.setTimer(this, this.main, .1, 20), this.scheduleOnce(function () {
                        this.isLock = !1, Global.utils.hideWaitting(), this.isAutoShowRank && (this.onClickRanking(),
                            this.isAutoShowRank = !1);
                    }.bind(this), 3);
                }
            },
            createRanking: function () {
                this.ranking = cc.instantiate(this.rankingPre), this.node.addChild(this.ranking),
                    this.ranking.setPosition(-230, 0), this.mask.parent = this.ranking, this.mask.setSiblingIndex(0),
                    this.doAction();
            },
            scrollToShow: function () {
                this.isShow = !0;
                var e = function () {
                    this.isScrolling = !1;
                }.bind(this);
                this.ranking.runAction(new cc.Sequence(cc.moveBy(.2, 607, 0).easing(cc.easeBackIn(3)), cc.callFunc(e)));
            },
            scrollToHide: function () {
                this.isShow = !1;
                var e = function () {
                    this.isScrolling = !1;
                }.bind(this);
                this.ranking.runAction(new cc.Sequence(cc.moveBy(.2, -607, 0).easing(cc.easeBackOut(3)), cc.callFunc(e)));
            },
            onClickMask: function () {
                this.onClickRanking();
            },
            onClickFriendRank: function () {
                console.log("onClickFriendRank"), o.playEffect("select"), this.resetFriRankType();
            },
            hideBigRank: function () {
                this.mask.active = !1, this.scrollToHide();
            },
            _setRankType_WXonShow: function (e) {
                this.isShow && this.hideBigRank(), this.setRankTypeByShareTicket(e);
            },
            setShareTicket: function (e) {
                this.shareTicket = e;
            },
            setRankTypeByShareTicket: function (e) {
                this.setShareTicket(e), this.shareTicket ? this.showRank(Global.config.RankType.GROUP) : this.showRank(Global.config.RankType.FRIEND);
            },
            getRankType: function () {
                return this.rankType;
            },
            resetFriRankType: function () {
                var e = Global.config.QueryTag.groupRank;
                Global.query && Global.query.extraInfo && Global.query.extraInfo[e] && (Global.query.extraInfo[e] = null),
                    this.setShareTicket(null);
            },
            unDraw: function () {
                this.main && tywx.Timer.cancelTimer(this, this.main);
            },
            onDestroy: function () {
                this.unDraw(), Global.notificationCenter.offAll(this), this.resetFriRankType();
            }
        })
    }